package com.itheima.clientAndService01;

import java.io.*;
import java.util.Arrays;

public class IOClass10 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new FileReader("day12\\a.txt"));
        String s = br.readLine();
        System.out.println("读取到的数据为：" + s);
        br.close();
        String[] str = s.split(" ");
        int[] arr = new int[str.length];

        for (int i = 0; i < str.length; i++) {
            arr[i] = Integer.parseInt(str[i]);
        }
        Arrays.sort(arr);
        String string = Arrays.toString(arr);
        System.out.println(string);

        BufferedWriter bw = new BufferedWriter(new FileWriter("day12\\b.txt"));
//        bw.write(string);
        for (int i = 0; i < arr.length; i++) {
            bw.write(arr[i] + " ");
            bw.flush();
        }
        bw.close();
    }
}
